﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Upeu.Matricula.Data.Entities;

namespace Upeu.Matricula.Data.Mappings
{
    public class CuentaTutorMap : EntityTypeConfiguration<CuentaTutor>
    {
        public CuentaTutorMap()
        {
            ToTable("cuentatutor");

            HasKey(t => t.IdCuentaTutor);
            Property(t => t.IdCuentaTutor)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);


            Property(t => t.Estado).IsRequired();
            Property(t => t.FechaPago).IsRequired();

            this.HasRequired(t => t.Cuenta)
                .WithMany(t => t.Cuentatutors)
                .HasForeignKey(t => t.Cuenta_Id);


            this.HasRequired(t => t.Tutor)
                .WithMany(t => t.Cuentatutors)
                .HasForeignKey(t=>t.Tutor_Id);  
           
        }
    }
}
